/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __WMO_FILE_H__
#define __WMO_FILE_H__

#include "WowCommon.h"
#include "WMOGroupFile.h"
#include "WowArchive.h"

namespace PQGameCore
{
	/*
	WMO files contain world map objects. They, too, have a chunked structure just like the WDT files.
	There are two types of WMO files, actually:
	WMO root file - lists textures (BLP Files), doodads (M2 or MDX Files), etc., and orientation for the WMO groups
	WMO group file - 3d model data for one unit in the world map object
	The root file and the groups are stored with the following filenames:
	World\wmo\path\WMOName.wmo
	World\wmo\path\WMOName_NNN.wmo
	*/
	/*
	The file format should have a header for file content entries position info
	*/
	class WMOFile
	{
	private:
		PQEngine::FileBase *mpq_file;
		int version;
	public:
		WMOGroupFile **groups;
		WMOFile(PQEngine::FileBase* f);

		void init(PQEngine::FileBase* f);

		wmo_mohd *mohd;
		void initMOHD(PQEngine::FileBase *f,int size);

		char* motx;
		void initMOTX(PQEngine::FileBase *f,int size);

		wmo_momt *momts;
		int momtCount;
		void initMOMT(PQEngine::FileBase *f,int size);

		char* mogn;
		void initMOGN(PQEngine::FileBase *f,int size);

		wmo_mogi *mogis;
		void initMOGI(PQEngine::FileBase *f,int size);

		void initMOSB(PQEngine::FileBase *f,int size);

		float *mopv;
		int pvsize;//in bytes
		void initMOPV(PQEngine::FileBase *f,int size);

		void initMOPT(PQEngine::FileBase *f,int size);

		wmo_mopr* moprs;
		int prsize;
		void initMOPR(PQEngine::FileBase *f,int size);	
		void initMOVV(PQEngine::FileBase *f,int size);
		void initMOVB(PQEngine::FileBase *f,int size);

		wmo_molt *molts;
		void initMOLT(PQEngine::FileBase *f,int size);

		wmo_mods* modss;
		void initMODS(PQEngine::FileBase *f,int size);


		char* modns;//Map object doodads names
		void initMODN(PQEngine::FileBase *f,int size);

		wmo_modd *modds;
		int ddsize;
		int ddcnt;
		void initMODD(PQEngine::FileBase *f,int size);

		wmo_mfog *mfogs;
		int fogcnt;
		void initMFOG(PQEngine::FileBase *f,int size);
		void initMCVP(PQEngine::FileBase *f,int size);
	};
}
#endif
